<?php $this->load->view("common/header") ?>
<script type="text/javascript">
$(function() {
	//	$( "#job_start" ).datepicker({ dateFormat: 'yy-mm-dd' });
	});
</script>
<body>
  <div id="page_wrapper">
<?php $this->load->view("common/speel") ?>


<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td  align="left" valign="top"><?php $this->load->view("nav/main") ?></td>
      <td width="1265" valign="top"  id="mainContent">
      <div id="crum">
<?php echo $crum ?>
</div><br>

      <form name="form1" method="post" action="<?php echo base_url() ."job/updatejob/" ?>">

          <table width="600" border="0" cellspacing="3" cellpadding="3">
            <tr>
              <td width="326" class="tblBodyNoneHover" colspan="2"></td>
              
            </tr>
            <tr>
              <td colspan="2" class="tbl_header">Update <?php echo $msg ?></td>
            </tr>
            <tr>
              <td colspan="2" class="fromLbl">&nbsp;</td>
            </tr>
            <tr>
              <td width="326" class="tbl_field_lable">Client</td>
              <td width="326" class="tbl_field_input"><select name="company_id" id="company_id">
                <?php foreach($companies as $company){ ?>
                <option value="<?php echo $company['id'] ?>"
              	 <?php if ($job[0]['company_id'] == $company['id'])  echo 'selected'; ?>
                > <?php echo $company['company_name']?></option>
                <?php } ?>
              </select></td>
            </tr>
            <tr>
              <td valign="top" class="tbl_field_lable">Job Subject</td>
              <td valign="top" class="tbl_field_input"><textarea name="job_subject" cols="50" rows="3" id="job_subject"><?php echo $job[0]['job_subject']  ?>
            </textarea></td>
            </tr>
            <tr>
              <td valign="top" class="tbl_field_lable">Description</td>
              <td valign="top" class="tbl_field_input"><textarea name="job_description" cols="50" rows="5" id="job_description"><?php echo $job[0]['job_description']  ?>
            </textarea></td>
            </tr>
            <tr>
              <td valign="top" class="tbl_field_lable">Type</td>
              <td valign="top" class="tbl_field_input"><select name="job_type" id="job_type">
                <?php foreach($job_types as $type){ ?>
                <option value="<?php echo $type['lu_value'] ?>"
              	 <?php if ($job[0]['job_type_id'] == $type['lu_value'] )  echo 'selected'; ?>
              ><?php echo $type['lu_lable']?></option>
                <?php } ?>
              </select></td>
            </tr>
            <tr>
              <td valign="top" class="tbl_field_lable">Pirority</td>
              <td valign="top" class="tbl_field_input"><select name="job_pri" id="job_pri">
                <?php foreach($job_pri as $pri){ ?>
                <option value="<?php echo $pri['lu_value'] ?>"
              	<?php if ($job[0]['job_pri_id'] == $pri['lu_value'] )  echo 'selected'; ?>
              ><?php echo $pri['lu_lable']?></option>
                <?php } ?>
              </select></td>
            </tr>
            <tr>
              <td valign="top" class="tbl_field_lable">Logged at</td>
              <td valign="top" class="tbl_field_input"><input name="job_logged" type="text" id="job_logged" value=" <?php echo $job[0]['job_logged']  ?>" size="40" readonly></td>
            </tr>
            <tr>
              <td valign="top" class="tbl_field_lable">Logged by</td>
              <td valign="top" class="tbl_field_input"><select name="job_logged_by" id="job_logged_by">
                <?php foreach($job_users as $user){ ?>
                <option value="<?php echo $user['id'] ?>"
              	 <?php if ($job[0]['job_logged_by'] == $user['id'] )  echo 'selected'; ?>
              ><?php echo $user['firstname']. " " . $user['lastname'] ."  (" . $user['username'] .")"?></option>
                <?php } ?>
              </select></td>
            </tr>
            <tr>
              <td valign="top" class="tbl_field_lable">Job Start</td>
              <td colspan="2" valign="top" class="tbl_field_input"><input name="job_start_date" type="text" id="job_start_date" size="20" value="" data="<?php echo date("Y-m-d", strtotime($job[0]['job_start'])) ?>">
                <input type="hidden" name="job_start_date_h" id="job_start_date_h">
                <select name="job_start_time_hr" id="job_start_time_hr">
                  <?php echo gen_time_dropdown('hr',date("h", strtotime($job[0]['job_start']))) ?>
                </select>
:

<select name="job_start_time_min" id="job_start_time_min">
<?php echo gen_time_dropdown('min',date("i", strtotime($job[0]['job_start']))) ?>
</select></td>
            </tr>
            <tr>
              <td valign="top" class="tbl_field_lable">Job End</td>
              <td colspan="2" valign="top" class="tbl_field_input"><input name="job_end_date" type="text" id="job_end_date" size="20"  value="" data="<?php echo date("Y-m-d", strtotime($job[0]['job_end'])) ?>">
                <input type="hidden" name="job_end_date_h" id="job_end_date_h">
                <select name="job_end_time_hr" id="job_end_time_hr">
                                    <?php echo gen_time_dropdown('hr',date("h", strtotime($job[0]['job_end']))) ?>
                </select>
:
<select name="job_end_time_min" id="job_end_time_min">
                                    <?php echo gen_time_dropdown('min',date("i", strtotime($job[0]['job_end']))) ?>
</select></td>
            </tr>
            <tr>
              <td class="tbl_field_lable">Notes</td>
              <td class="tbl_field_input"><a href="javascript:;" onClick="openw('<?php echo base_url()."/job/newnote/".$job[0]['id']?>','width=700,height=600')">Add a note</a>
              </td>
            </tr>
            <tr>
              <td><input name="action" type="hidden" id="action" value="update">
              <input name="id" type="hidden" id="id"  value="<?php echo $job[0]['id']  ?>"></td>
              <td><input name="button" type="submit" class="tblBtn" id="button" value=" Update "></td>
            </tr>
          </table>
       
      </form></td>
    </tr>
</table>

<?php $this->load->view("common/footer") ?>
</div>
</body>
</html>
